<template>
	<view class="tui-center">
		<uni-nav-bar fixed left-icon="back" title="设置" @clickLeft="clickLeft()"></uni-nav-bar>
		<view style="background-color: #F8F8F8;height: 10rpx;"></view>
		<view class="list-cell br-b b-b m-t" @click="navTo('/pagesA/set/components/personal')" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">个人资料</text>
			<uni-icons type="arrowright" color="#999" size="40"></uni-icons>
		</view>
		<view class="list-cell br-b b-b" @click="navTo('/pagesA/set/components/contacts')" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">联系人管理</text>
			<uni-icons type="arrowright" color="#999" size="40"></uni-icons>
		</view>
		<view class="list-cell b-b" @click="getNav" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">实名认证</text>
			<text class="cell-txt">{{userInfo.isReal == 1 ? '已认证':'未认证'}}</text>
			<uni-icons v-if="userInfo.isReal == 0" type="arrowright" color="#999" size="40"></uni-icons>
		</view>
		<view class="list-cell log-out-btn" @click="toLogout">
			<text class="cell-tit">退出登录</text>
		</view>

		<!-- 登录提示 -->
		<uni-login-model></uni-login-model>
	</view>
</template>

<script>
	import uniIcons from "@/components/uni-icons/uni-icons.vue"
    import uniLoginModel from '@/components/uni-login-model/uni-login-model.vue'
    import { mapMutations, mapActions, mapState } from 'vuex'
	
	export default {
		name: 'set',
		components: {
			uniIcons, uniLoginModel
		},
		data() {
			return {
				
			}
		},
        computed: {
            ...mapState({
                userInfo: state => state.user.userInfo
            })
        },
		methods: {
			//退出登录
			toLogout(){
				uni.showModal({
				    content: '确定要退出登录么',
					success: (e)=>{
						if(e.confirm){
                            this.$store.dispatch('LogOut').then(res => {
                            }).catch(error => {
                            })
						}
					}
				});
			},
			getNav() {
				if (this.userInfo.isReal == 0) {
                    uni.navigateTo({
                        url: '/pagesA/realName/realName'
                    })
				}

			},
			navTo(url){
				uni.navigateTo({
					url: url
				})
			},
			clickLeft() {
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss">
	.list-cell {
		display: flex;
		align-items: baseline;
		padding: 20rpx $uni-spacing-row-lg;
		line-height: 60rpx;
		position:relative;
		background: $uni-bg-color;
		justify-content: center;
		&.b-b:after{
			left: 30rpx;
		}
		&.m-t{
			margin-top: 16rpx;
		}
		.cell-tit{
			flex: 1;
			font-size: $uni-font-size-md;
			color: $font-color-dark;
			margin-right: $uni-spacing-row-sm;
		}
		.cell-txt {
			font-size: $uni-font-size-base;
			color: $font-color-dark;
			margin-right: $uni-spacing-row-sm;
		}
		.cell-tip{
			font-size: $uni-font-size-md;
			color: $font-color-dark;
		}
		&.log-out-btn{
			margin-top: 40rpx;
			.cell-tit{
				color: $uni-color-primary;
				text-align: center;
				margin-right: 0;
			}
		}
	}
</style>
